# This file is part of BlackArch Linux ( https://www.blackarch.org/ ).
# See COPYING for license details.

pkgname=phonia
pkgver=593.8ae14ff
pkgrel=8
pkgdesc='Advanced toolkits to scan phone numbers using only free resources.'
groups=('blackarch' 'blackarch-social' 'blackarch-scanner')
arch=('any')
url='https://github.com/entynetproject/phonia'
license=('MIT')
depends=('python' 'python-phonenumbers' 'python-colorama' 'python-requests'
         'python-selenium' 'python-beautifulsoup4' 'python-html5lib'
         'python-config' 'geckodriver')
makedepends=('git')
source=("git+https://github.com/entynetproject/$pkgname.git")
sha512sums=('SKIP')

pkgver() {
  cd $pkgname

  echo $(git rev-list --count HEAD).$(git rev-parse --short HEAD)
}

package() {
  cd $pkgname

  install -dm 755 "$pkgdir/usr/bin"
  install -dm 755 "$pkgdir/usr/share/$pkgname"

  install -Dm 644 -t "$pkgdir/usr/share/doc/$pkgname/" README.md
  install -Dm 644 LICENSE "$pkgdir/usr/share/licenses/$pkgname/LICENSE"

  rm README.md LICENSE

  cp -a * "$pkgdir/usr/share/$pkgname/"

  cat > "$pkgdir/usr/bin/$pkgname" << EOF
#!/bin/sh
cd /usr/share/$pkgname
exec python $pkgname "\$@"
EOF

  chmod +x "$pkgdir/usr/bin/$pkgname"
}

